import { getUserListServices } from '@/services/userServices'

const userManager = {
  namespaced:true,
  state: {
    userList:[],
    pageNum:1,
    pageSize:15,
    total:0
  },
  mutations: {
    setUserList(state,payload){
      state.userList = payload.list
      state.pageNum = payload.pageNum
      state.pageSize = payload.pageSize
      state.total = payload.total
    }
  },
  actions:{
    async getUserListAction({commit},payload){
      console.log(payload)
      let res = await getUserListServices(payload)
      if(res.code === 0){
        console.log(res)
        commit('setUserList',res.data)

      }
    }
  },
  getters: {
    getUserList(state){
      return state.userList
    }
  }
}

export default userManager